package routers

import (
	"github.com/gin-gonic/gin"

	v1 "application/api/v1"
	"application/middle"
)

// InitRouter 初始化路由信息
func InitRouter() *gin.Engine {
	r := gin.Default()
	r.GET("/qqLogin", middle.Cors(), v1.GetTokens)
	//QQ登录信息上链
	r.GET("/qqAdd", v1.GetUserInfos)
	//微信登录
	r.GET("/wechat", v1.InitCallBack)
	apiV1 := r.Group("/api/v1")
	{
		apiV1.GET("/hello", v1.Hello)
		apiV1.POST("/queryAccountList", v1.QueryAccountList)
		apiV1.POST("/createRealEstate", v1.AddHouse)
		apiV1.POST("/file", v1.File)
		apiV1.POST("/queryRealEstateList", v1.QueryRealEstateList)
		apiV1.POST("/createSelling", v1.CreateSelling)
		apiV1.POST("/createSellingByBuy", v1.CreateSellingByBuy)
		apiV1.POST("/querySellingList", v1.QuerySellingList)
		apiV1.POST("/querySellingListByBuyer", v1.QuerySellingListByBuyer)
		apiV1.POST("/updateSelling", v1.UpdateSelling)
		apiV1.POST("/createDonating", v1.CreateDonating)
		apiV1.POST("/queryDonatingList", v1.QueryDonatingList)
		apiV1.POST("/queryDonatingListByGrantee", v1.QueryDonatingListByGrantee)
		apiV1.POST("/updateDonating", v1.UpdateDonating)
		//不良信息上链
		apiV1.POST("/addBadRecord", v1.AddBadRecord)
		//查询不良信息
		apiV1.GET("/queryBadRecord", v1.QueryBadRecord)
		//用户手机验证码注册
		//apiV1.POST("/register/mobile", v1.Register)
		//qq登录
		apiV1.GET("/toLogin", middle.Cors(), v1.GetAuthCodes)
		//QQ登录
		//apiV1.GET("/qqLogin", v1.GetTokens)
		//微信登录
		apiV1.GET("/access_token", v1.CheckSignature)
		apiV1.GET("/stable_token", v1.InitFoundation)
		apiV1.GET("/wechat_login", v1.InitWechatLogin)
	}
	return r
}
